const https = require('https')
const http = require('http')
const fs = require('fs')
const express = require('express')

const app = express()
app.use('/assets', express.static(__dirname + '/../dist'))
app.get('/', (req, res) => {
  fs.createReadStream(`${__dirname}/../dist/index.html`)
  .pipe(res)
  .on('error', console.log)
})
app.get('/favicon.ico', (req, res) => {
  fs.createReadStream(`${__dirname}/../dist/favicon.ico`)
  .pipe(res)
  .on('error', console.log)
})

const options = {
  key: fs.readFileSync(__dirname + '/a.key'),
  cert: fs.readFileSync(__dirname + '/a.crt')
};

http.createServer(app).listen(3000);